157

Advanced Graphics

157

STEP 8 continued

          Set rRange =​ Range(thisWs.Cells(1, 2 * mm), thisWs.Cells(1, 2 * mm))

          ActiveChart.SeriesCollection(jj).Name =​ “=​‘Any State’!” & rRange.

Address(True, True, xlR1C1)

          Set rRange =​ Range(thisWs.Cells(startrow(1), 1), thisWs.Cells(j, 1))

          ActiveChart.SeriesCollection(jj).XValues =​ “=​‘Any State’!” & rRange.

Address(True, True, xlR1C1)

          StateExists =​ ShapeColor(Left(thisWs.Cells(1, 2 * mm), 2))

        End If

      Next

   

End If

End If

ActiveSheet.Shapes(NameOfOverallChart).ZOrder msoBringToFront

ActiveSheet.Cells(23, 2) =​ Format(Now, “YYYYMMDD”)

fileopenWb.Close (True)

End Sub

Other Functions

These are functions that are called from the code and from the form elements.

Function ShapeColor(Label)

Dim ashp As Shape

On Error GoTo error_​handler:

ShapeExists =​ True

ActiveSheet.Shapes(Label).Select

Selection.ShapeRange(1).Fill.ForeColor.RGB =​ RGB(255, 255, 0)

Exit Function

error_​handler:

ShapeExists =​ False

End Function

Private Sub OptionButton1_​Click()

UserForm1.OptionButton2 =​ False

End Sub

Private Sub OptionButton2_​Click()

UserForm1.OptionButton1 =​ False

End Sub

Private Sub OptionButton3_​Click()

UserForm1.OptionButton4 =​ False

End Sub

Private Sub OptionButton4_​Click()

UserForm1.OptionButton3 =​ False

End Sub

Private Sub TextBox1_​Change()

UserForm1.TextBox1.ForeColor =​ vbBlack

UserForm1.Caption =​ “ Covid”

a =​ InStr(1, UserForm1.TextBox1, “*”)

If a =​ 0 Then

    a =​ InStr(1, UserForm1.TextBox1, “.”)

End If